home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Presentations / Presentations ’97 / Sessions ’97 / Java for Macintosh Applications / JDK Native / TimeUtils.java < prev    next >
Encoding:
Text File  |  1997-06-27  |  810 b   |  37 lines  |  [TEXT/CWIE]

  1. /*
  2.     TimeUtils.java
  3.  
  4.     Demonstration of JDK Native Methods.
  5.  
  6.     © 1997 by Michael J. Webb (mjw@codewell.com)
  7.  
  8. */
  9.  
  10. class TimeUtils
  11. {
  12.  
  13.     /** The following code is claimed to cause JDK to try to load
  14.         our shared library.  It is also claimed to be case sensitive
  15.         (which seems odd for MacOS).  It uses CFM to load the shared
  16.         library - so putting an alias to the shared library in the
  17.         "JavaSoft Folder" folder is usually a good thing.
  18.      */
  19.     static
  20.     {
  21.         System.loadLibrary("TimeUtilsPPC");
  22.     }
  23.  
  24.     /** A static native method to access the system clock.
  25.      */
  26.     public static native int GetRealTime();
  27.  
  28.     /** A static native method to get the tick count.
  29.      */
  30.     public static native int GetRelativeTime();
  31.  
  32.     /** A static native method to get a time string.
  33.      */
  34.     public static native String GetTimeString(int someTime);
  35.  
  36. }
  37.